import json,logging,yagmail

def set_log():
    logging.basicConfig(level=logging.INFO,
                        filemode='w+',
                        filename='./Log/jiekou.log',
                        format='%(lineno)s %(levelname)s %(message)s %(asctime)s %(filename)s')

    # 控制台输出log日志
    handler = logging.StreamHandler()
    handler.setLevel(logging.INFO)

    # 格式一致
    format = logging.Formatter('%(lineno)s %(levelname)s %(message)s %(asctime)s %(filename)s')
    handler.setFormatter(format)

    logger = logging.getLogger()
    logger.addHandler(handler)

def send_email(file):
    yaml = yagmail.SMTP(user='1847537889@qq.com',password='liavbivsorckhacj',host='smtp.qq.com')
    yaml.send(to='1847537889@qq.com',subject='9.8月考练习',contents='维度电商的接口',attachments=file)




def read_json(file):
    with open(file,'r',encoding='utf-8') as f:
        return json.load(f)


